var path = window.location.href;
var a=getQueryString("customer_price_id")
var b=getQueryString("discount_value")
var c=getQueryString("effective_date")
$("#discount_rate_id").val(b)
$("#logmin").val(c)

// 保存按钮
$("#form-member").validate({
    rules: {
        id:"idCheck"
    },
    //提交表单数据
    submitHandler:function(form){

        //获取
        var discount_rate_id=$("#discount_rate_id").val(),
            started_at = $("#logmin").val()
        //提交
        $.ajax({
            contentType: 'application/json',
            url: 'http://192.168.0.53:8580/product/customerPrice/updataCustomerPrice',
            type: 'POST',
            data: JSON.stringify({
                lastModifiedBy:10086,
                discountValue:discount_rate_id,
                effectiveDate:started_at,
                customerPriceId:a,
            }),
            success: function (data) {
                console.log(data)
                if(data.errorCode=="0") {
                    layer.msg('操作成功!', {icon: 6, time: 1000});
                    setTimeout( function () {
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index)
                    },700);
                }
            }
        });
        // var user_data = {
        //     // /*title : title,*/
        //     // /*subject_id : subject_id,
        //     // subject_name : subject_name,*/
        //     // discount_rate_id:discount_rate_id,
        //     // release_time : started_at,
        //     // /*end_in : end_in,*/
        //     // category_id :category_id
        //     // //25
        //     creationBy:10086,
        //     discountValue:discount_rate_id,
        //     effectiveDate:started_at,
        // };
        //获取返回的数据
        //  succCallBack = function (data, status, response) {
        //     console.log(data);
        //     if(errorCode=="0") {
        //         layer.msg('操作成功!', {icon: 6, time: 1000});
        //     }
        // }

        //给一个接口地址提交数据
        // return web.doAjax("http://192.168.7.175:8080/webapp/customerPrice/addCustomerPrice", 'post', user_data, succCallBack);
    }
})
//初始化客户归属下拉列表
function ascription() {
    var user_data = {}
    var succCallBack = function (data, status, response) {
        //console.log(data)
        if (data.errorCode == "0") {
            var dataInter = data.group;
            var interText = doT.template($("#ascription_bob").text());
            $("#ascription_lsit").html(interText(dataInter));
        }
    };
    return web.doAjax(root.inter.getGroup, 'post', user_data, succCallBack);
}
function removeIframe(){
    var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);
}